package org.example.hadoop.domain;

import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

/**
 * @author wwy
 * @date 2020-11-10 19:53
 */
public class AuthorRatingScoreAvgBean implements WritableComparable<AuthorRatingScoreAvgBean> {
    //统计数量
    private double count;

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeDouble(this.count);
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        count = dataInput.readDouble();
    }

    @Override
    public int compareTo(AuthorRatingScoreAvgBean o) {
        if(o.getCount() - this.count>0){
            return 1;
        }else{
            return -1;
        }
    }

    public double getCount() {
        return count;
    }

    public void setCount(double count) {
        this.count = count;
    }


    @Override
    public String toString() {
        return "AuthorCountBean{" +
                "count=" + count +
                '}';
    }
}
